import request from '@/utils/request'

type Common<T> = {
  code: string,
  data: T
  mesg: string
  time: string
}
export type Role = {
  code: string
  createdBy: string
  createdTime: string
  description: string
  id: number
  name: string
  operatorId: number | null
  updatedBy: string
  updatedTime: string
}
export type QueryRoles ={
  current: number
  hitCount?: boolean
  optimizeCountSql?: boolean
  orders?: any[]
  pages: number
  records: Role[] | []
  searchCount?: boolean
  size: number
  total: number
}

export type Condition = Partial<{
  code: string
  id: number
  name: string
  startCreateTime: string
  endCreateTime: string
  current: number
  size: number
}>

//按条件获取角色
export const getRolePages = (condition : Condition) => {
    return request<Common<QueryRoles>>({
        method: 'POST',
        url: '/boss/role/getRolePages',
        data: condition
    })
}